;Exercise 1.3 - Define a procedure that takes three numbers as arguments
;and returns the sum of the squares of the two larger numbers.

(define (sum-of-squares x y)
  (+ (* x x) (* y y)))


;TODO: Remove code duplication inside the cond forms...
(define (sum-of-squares-of-larger number1 number2 number3)
  (cond ((> number1 number2)
         (if (> number2 number3)
             (sum-of-squares number1 number2)
             (sum-of-squares number1 number3)))

        ((> number1 number3)
         (if (> number2 number3)
             (sum-of-squares number1 number2)
             (sum-of-squares number1 number3)))

        (else (sum-of-squares number2 number3))))




(sum-of-squares-of-larger 1 3 2)


